<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>持名法州主页</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/themes/IconExtension.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/china.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/echarts.js"></script>
    <script type="text/javascript">


        $(function(){
            //把修改隐藏起来
            $("#updateDiv").dialog({
                width:400,
                height:100,
                title:"修改密码",
                closable:true,
                closed:true,//隐藏
                modal:true
            })
            //密码修改
            $("#xiugaianniu").click(function(){
                //点击修改密码按钮,把修改框打开
                $("#updateDiv").dialog("open");
            })

            //开始修改
            $("#toUpdate").click(function () {
                $("#updateform").form("submit",{
                    url:"${pageContext.request.contextPath}/update",
                    success:function (data) {
                        if(JSON.parse(data).updateok){
                            alert("修改成功");
                            $("#updateDiv").dialog("close");

                        }else {
                            alert("修改失败");
                        }
                    }
                })
            })


            //获取数据库的数据AJAX
            $.ajax({
                url:"${pageContext.request.contextPath}/getAll",
                dataType:"JSON",
                success:function (data) {
                    //对数据进行展示循环
                    console.info(data)
                    $.each(data,function (index, first) {
                        var c='';
                        //再循环一次二级
                        $.each(first.menu,function (index1,second) {
                            c += "<div style='text-align: center'><a href='#' class='easyui-linkbutton' data-options=\"iconCls:'icon-search',plain:true\" onclick=\"addTabs('" + second.name + "','" + second.url + "')\">" + second.name + "</a></div>";
                        });

                        $("#aa").accordion("add",{
                            title: first.name,
                            content: c,
                            selected: false
                        });

                    })
                }
            })
        })


        function addTabs(name,url) {
            var ee = $("#tt").tabs("exists", name);
            if(ee){
                $("#tt").tabs("select", name);
            }else {
                $("#tt").tabs("add",{
                    title:name,
                    href:"${pageContext.request.contextPath}"+url,
                    closable:true,
                    tools:[{
                        iconCls:'icon-mini-refresh',
                        handler:function(){
                            alert('refresh');
                        }
                    }]
                });
            }
        }








        <!--菜单处理-->
    </script>

</head>
<body class="easyui-layout">
<div data-options="region:'north',split:true" style="height:60px;background-color:  #5C160C">
    <div style="font-size: 24px;color: #FAF7F7;font-family: 楷体;font-weight: 900;width: 500px;float:left;padding-left: 20px;padding-top: 10px" >持名法州后台管理系统</div>
    <div style="font-size: 16px;color: #FAF7F7;font-family: 楷体;width: 400px;float:right;padding-top:15px">欢迎您:${sessionScope.admin.username} &nbsp;
        <a href="javaScript:void(0)" id="xiugaianniu" class="easyui-linkbutton" data-options="iconCls:'icon-edit'">修改密码</a>&nbsp;&nbsp;
        <a href="${pageContext.request.contextPath}/destory" class="easyui-linkbutton" data-options="iconCls:'icon-01'">退出系统</a></div>
</div>
<div data-options="region:'south',split:true" style="height: 40px;background: #5C160C">
    <div style="text-align: center;font-size:15px; color: #FAF7F7;font-family: 楷体" >&copy;百知教育 htf@zparkhr.com.cn</div>
</div>

<div data-options="region:'west',title:'导航菜单',split:true" style="width:220px;">
    <div id="aa" class="easyui-accordion" data-options="fit:true">

    </div>
</div>
<div data-options="region:'center'">
    <div id="tt" class="easyui-tabs" data-options="fit:true,narrow:true,pill:true">
        <div title="主页" data-options="iconCls:'icon-neighbourhood',"  style="background-image:url(${pageContext.request.contextPath}/main/image/shouye.jpg);background-repeat: no-repeat;background-size:100% 100%;"/>
    </div>
</div>

<div id="updateDiv">
        <form  method="post" id="updateform"/>
            <input type="hidden" name="id" id="updateid"/>
            用户名:<input  name="username"  id="updateusername"/></br>
            请输入新密码：:<input  name="password" id="updatepassword"/></br>
            <input type="button" id="toUpdate" value="提交"/></br>
        </form>
</div>
</body>
</html>y>